package com.yanqu.road.entity.union;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

public class UnionInfo extends DataObject {

	private String unionUid;

	private String unionName = "";

	private int unionFlag;       //会旗

	private long createTime;

	private String outNotice = "";

	private String innerNotice = "";

	private long experience;

	private long masterUserId;

	private String masterNickName = "";

	private long masterJoinTime;

	private String wechatCode = "";

	private String qqCode = "";

	private int memberCount;

	private boolean isAllowRandomJoin;

	private BigInteger totalEarnSpeed = BigInteger.ZERO;

	private long wealth;

	private boolean isDelete = false;

	private long modifyTime;

	private int unionFightRewardMark;

	private long flagModifyTime;

	private int constructActive;

	private long vipExp;

	private List<Long> constructUserIdList = new ArrayList<>();

	private long unionAliasId;             //商会别名编号，不能做key

	private String decoration = "";

	private  int rankActivityId;       //活动id

	private  long rankAddExp;          //排行增加值

	private int preUnionFlag;

	private int dayJoinNum;            //当天入会人数

	private int dayKickNum;            //当天踢人人数

	private int applyTitleLimit;

	private long deleteCoolingOffTime;	//解散冷静期

	/**
	 * 加入实力限制, k:实力档位 v:数量上限
	 */
	private Map<Integer, Integer> joinGradeLimit = new ConcurrentHashMap<>();
	/**
	 * 评定时的档位人数 k:实力档位 v:数量
	 */
	private Map<Integer, Integer> gradeAmountMap = new ConcurrentHashMap<>();

	public UnionInfo() {
	}

	public UnionInfo(String unionUid) {
		this.unionUid = unionUid;
		setInsertOption();
	}

	public String getUnionUid() {
		return unionUid;
	}

	public void setUnionUid(String unionUid) {
		if(!Objects.equals(this.unionUid, unionUid)) {
			this.unionUid = unionUid;
			setUpdateOption();
		}
	}

	public String getUnionName() {
		return unionName;
	}

	public void setUnionName(String unionName) {
		if(!Objects.equals(this.unionName, unionName)) {
			this.unionName = unionName;
			setUpdateOption();
		}
	}

	public int getUnionFlag() {
		return unionFlag;
	}

	public void setUnionFlag(int unionFlag) {
		if(this.unionFlag != unionFlag) {
			this.unionFlag = unionFlag;
			setUpdateOption();
		}
	}

	public long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(long createTime) {
		if(this.createTime != createTime) {
			this.createTime = createTime;
			setUpdateOption();
		}
	}

	public String getOutNotice() {
		return outNotice;
	}

	public void setOutNotice(String outNotice) {
		if(!Objects.equals(this.outNotice, outNotice)) {
			this.outNotice = outNotice;
			setUpdateOption();
		}
	}

	public String getInnerNotice() {
		return innerNotice;
	}

	public void setInnerNotice(String innerNotice) {
		if(!Objects.equals(this.innerNotice, innerNotice)) {
			this.innerNotice = innerNotice;
			setUpdateOption();
		}
	}

	public long getExperience() {
		return experience;
	}

	public void setExperience(long experience) {
		if(this.experience != experience) {
			this.experience = experience;
			setUpdateOption();
		}
	}

	public long getMasterUserId() {
		return masterUserId;
	}

	public void setMasterUserId(long masterUserId) {
		if(this.masterUserId != masterUserId) {
			this.masterUserId = masterUserId;
			setUpdateOption();
		}
	}

	public String getMasterNickName() {
		return masterNickName;
	}

	public void setMasterNickName(String masterNickName) {
		if(!Objects.equals(this.masterNickName, masterNickName)) {
			this.masterNickName = masterNickName;
			setUpdateOption();
		}
	}

	public long getMasterJoinTime() {
		return masterJoinTime;
	}

	public void setMasterJoinTime(long masterJoinTime) {
		if(this.masterJoinTime != masterJoinTime) {
			this.masterJoinTime = masterJoinTime;
			setUpdateOption();
		}
	}

	public String getWechatCode() {
		return wechatCode;
	}

	public void setWechatCode(String wechatCode) {
		if(!Objects.equals(this.wechatCode, wechatCode)) {
			this.wechatCode = wechatCode;
			setUpdateOption();
		}
	}

	public String getQqCode() {
		return qqCode;
	}

	public void setQqCode(String qqCode) {
		if(!Objects.equals(this.qqCode, qqCode)) {
			this.qqCode = qqCode;
			setUpdateOption();
		}
	}

	public int getMemberCount() {
		return memberCount;
	}

	public void setMemberCount(int memberCount) {
		if(this.memberCount != memberCount) {
			this.memberCount = memberCount;
			setUpdateOption();
		}
	}

	public boolean isAllowRandomJoin() {
		return isAllowRandomJoin;
	}

	public void setAllowRandomJoin(boolean allowRandomJoin) {
		if(this.isAllowRandomJoin != allowRandomJoin) {
			isAllowRandomJoin = allowRandomJoin;
			setUpdateOption();
		}
	}

	public BigInteger getTotalEarnSpeed() {
		return totalEarnSpeed;
	}

	public void setTotalEarnSpeed(BigInteger totalEarnSpeed) {
		if(!Objects.equals(this.totalEarnSpeed, totalEarnSpeed)) {
			this.totalEarnSpeed = totalEarnSpeed;
			setUpdateOption();
		}
	}

	public long getWealth() {
		return wealth;
	}

	public void setWealth(long wealth) {
		if(this.wealth != wealth) {
			this.wealth = wealth;
			setUpdateOption();
		}
	}

	public boolean isDelete() {
		return isDelete;
	}

	public void setDelete(boolean delete) {
		if(this.isDelete != delete) {
			isDelete = delete;
			setUpdateOption();
		}
	}

	public long getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(long modifyTime) {
		if(this.modifyTime != modifyTime) {
			this.modifyTime = modifyTime;
			setUpdateOption();
		}
	}

	public int getUnionFightRewardMark() {
		return unionFightRewardMark;
	}

	public void setUnionFightRewardMark(int unionFightRewardMark) {
		if(this.unionFightRewardMark != unionFightRewardMark) {
			this.unionFightRewardMark = unionFightRewardMark;
			setUpdateOption();
		}
	}

	public long getFlagModifyTime() {
		return flagModifyTime;
	}

	public void setFlagModifyTime(long flagModifyTime) {
		if(this.flagModifyTime != flagModifyTime) {
			this.flagModifyTime = flagModifyTime;
			setUpdateOption();
		}
	}

	public int getConstructActive() {
		return constructActive;
	}

	public void setConstructActive(int constructActive) {
		if(this.constructActive != constructActive) {
			this.constructActive = constructActive;
			setUpdateOption();
		}
	}

	public long getVipExp() {
		return vipExp;
	}

	public void setVipExp(long vipExp) {
		if(this.vipExp != vipExp) {
			this.vipExp = vipExp;
			setUpdateOption();
		}
	}

	public void setConstructUserIdList(List<Long> constructUserIdList) {
		this.constructUserIdList = constructUserIdList;
		setUpdateOption();
	}

	public String getConstructUserIdListString(){
		return StringUtils.listToString(constructUserIdList, ',');
	}

	public int getConstructUserCount(){
		return constructUserIdList.size();
	}

	public void addConstructUserId(long userId){
		if(!hasConstructUserId(userId)){
			constructUserIdList.add(userId);
			setUpdateOption();
		}
	}

	public boolean hasConstructUserId(long userId){
		return constructUserIdList.contains(userId);
	}

	public long getUnionAliasId() {
		return unionAliasId;
	}

	public void setUnionAliasId(long unionAliasId) {
		if(this.unionAliasId != unionAliasId) {
			this.unionAliasId = unionAliasId;
			setUpdateOption();
		}
	}

	public String getDecoration() {
		return decoration;
	}

	public void setDecoration(String decoration) {
		if(!Objects.equals(this.decoration, decoration)) {
			this.decoration = decoration;
			setUpdateOption();
		}
	}

	public int getRankActivityId() {
		return rankActivityId;
	}

	public void setRankActivityId(int rankActivityId) {
		if(this.rankActivityId != rankActivityId) {
			this.rankActivityId = rankActivityId;
			setUpdateOption();
		}
	}

	public long getRankAddExp() {
		return rankAddExp;
	}

	public void setRankAddExp(long rankAddExp) {
		if(this.rankAddExp != rankAddExp) {
			this.rankAddExp = rankAddExp;
			setUpdateOption();
		}
	}

	public int getPreUnionFlag() {
		return preUnionFlag;
	}

	public void setPreUnionFlag(int preUnionFlag) {
		if (this.preUnionFlag != preUnionFlag) {
			this.preUnionFlag = preUnionFlag;
			setUpdateOption();
		}
	}

	public int getDayJoinNum() {
		return dayJoinNum;
	}

	public void setDayJoinNum(int dayJoinNum) {
		if(this.dayJoinNum != dayJoinNum) {
			this.dayJoinNum = dayJoinNum;
			setUpdateOption();
		}
	}

	public int getApplyTitleLimit() {
		return applyTitleLimit;
	}

	public void setApplyTitleLimit(int applyTitleLimit) {
		if (!Objects.equals(this.applyTitleLimit, applyTitleLimit)) {
			this.applyTitleLimit = applyTitleLimit;
			setUpdateOption();
		}
	}

	public int getDayKickNum() {
		return dayKickNum;
	}

	public void setDayKickNum(int dayKickNum) {
		if(this.dayKickNum != dayKickNum) {
			this.dayKickNum = dayKickNum;
			setUpdateOption();
		}
	}

	public long getDeleteCoolingOffTime() {
		return deleteCoolingOffTime;
	}

	public void setDeleteCoolingOffTime(long deleteCoolingOffTime) {
		if(this.deleteCoolingOffTime != deleteCoolingOffTime) {
			this.deleteCoolingOffTime = deleteCoolingOffTime;
			setUpdateOption();
		}
	}

	public Map<Integer, Integer> getJoinGradeLimit() {
		return joinGradeLimit;
	}

	public void setJoinGradeLimit(Map<Integer, Integer> joinGradeLimit) {
		this.joinGradeLimit = joinGradeLimit;
		setUpdateOption();
	}

	public Map<Integer, Integer> getGradeAmountMap() {
		return gradeAmountMap;
	}

	public void setGradeAmountMap(Map<Integer, Integer> gradeAmountMap) {
		this.gradeAmountMap = gradeAmountMap;
		setUpdateOption();
	}
}
